<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/23 0023
 * Time: 17:04
 */
function resex($a)
{
    if ($a == 1) {
        $b = '男';
        return $b;
    } else if ($a == 2) {
        $b = '女';
        return $b;
    } else {
        $b = '未知';
        return $b;
    }
}

function type($a)
{
    if ($a) {
        $c = M('type')->field('typename')->where("id=" . $a)->find();
        return $c['typename'];
    } else {
        return '空';
    }

}

function img($aa)
{
    $a=$aa['img'];
    $c=$aa['id'];
    $shangxian = '';
//    $shangxian='http://tzltzl.top/';

    $kaifa = __ROOT__;
    $b = $kaifa ? $kaifa : $shangxian;
    if ($a) {
        $str = '';
        $num = 0;
        $count = count($a);

        foreach ($a as $k => $v) {
            $str .= "<td style='text-align: center;' onclick=\"kan('$b$v')\"><img src='$b$v' alt='图片' width='35%'/></td>";
            if ($num % 2 == 0) {
                $str = $str . "<tr/><tr>";
            }
            $num++;
        }
        $str = "<tr>" . substr($str, 0, -4)."<tr><td style='text-align:right;'>第 $c 件商品</td><td></td></tr>";
        return $str;

    } else {
        return '<tr><td style="text-align: center;">这个图片没有上传成功，可能是类型或大小限制引起的</td></tr>';
    }

}